/**
 * @Author：ming
 * @Date：2023/10/23 8:41 PM
 * @Filename：LC2908
 */

/**
 * @author ming
 */
public class LC2908 {
    public int minimumSum(int[] nums) {
        int index = -1;
        int len = nums.length;

        for (int i = 0; i < len-2; i++) {
            for (int j = i+1; j < len-1; j++) {
                if(nums[j]<=nums[i]){
                    continue;
                }
                for (int k = j+1; k < len; k++) {
                    if(nums[k]>=nums[j]){
                        continue;
                    }
                    int temp = nums[i]+nums[j]+nums[k];
                    if(index==-1){
                        index = temp;
                    }else if(temp<index){
                        index = temp;
                    }
                }
            }
        }

        return index;
    }
}
